import {
  Redirect
} from 'react-router-dom'
import HjAdmin from '../pages/admin'
import HjLogin from '../pages/login'
import HjHome from '../pages/home'
import HjProduct from '../pages/prod/product'
import HjDetail from '../pages/prod/product/c-cpn/detali'
import HjAddUpdate from '../pages/prod/product/c-cpn/add-update'
import HjCategory from '../pages/prod/category'
import HjUser from '../pages/user'
import HjRole from '../pages/role'
import HjBar from '../pages/picture/bar'
import HjLine from '../pages/picture/line'
import HjPie from '../pages/picture/pie'


const routes = [{
    path: '/',
    exact: true,
    render: () => ( < Redirect to = "/login" / > )
  },
  {
    path: '/login',
    component: HjLogin,

  },
  {
    path: '/admin',
    component: HjAdmin,
    routes: [{
        path: '/admin',
        exact: true,
        render: () => ( < Redirect to = "/admin/home" / > )
      }, {
        path: '/admin/home',
        component: HjHome,


      },
      {
        path: '/admin/prod/product',
        component: HjProduct,
        exact: true,
        routes: [{
          path: '/admin/prod/product/detail/:id',
          component: HjDetail
        }, {
          path: '/admin/prod/product/addupdate',
          exact: true,
          component: HjAddUpdate
        }, {
          path: '/admin/prod/product/addupdate/:id',
          component: HjAddUpdate
        }]

      },
      {
        path: '/admin/prod/category',
        component: HjCategory,

      },
      {
        path: '/admin/user',
        component: HjUser,

      },
      {
        path: '/admin/role',
        component: HjRole,

      },
      {
        path: '/admin/picture/bar',
        component: HjBar,

      },
      {
        path: '/admin/picture/line',
        component: HjLine,

      },
      {
        path: '/admin/picture/pie',
        component: HjPie,

      }
    ]
  },
]


export default routes